﻿<!-- 基础应用--操作权限 -->
<template>
    <div>

        <div class="btn-add">
            <button type="button" class="btn btn-success btn-lg" @click="saveczqx()"><i class="iconfont icon-chenggong ft12 mr5"></i>保存权限</button>
        </div>
        <div class="default-tab ft14  hover-btn" style="overflow-x: inherit;padding:20PX;padding-top:10px;margin-top:90px">
            <el-table :data="qxdata" stripe border fit style="width: 100%" class="mt10 ">

                <el-table-column type="selection"
                                 width="55">
                </el-table-column>
                <el-table-column type="index"
                                 width="50">
                </el-table-column>
                <el-table-column prop="qxdm"
                                 label="权限代码"
                                 width="100">
                </el-table-column>
                <el-table-column prop="qxname"
                                 label="权限名称"
                                 width="140">
                </el-table-column>

                <el-table-column prop="xq"
                                 label="学期"
                                 width="180">
                    <template slot-scope="scope">
                        <el-select placeholder="请选择学期" size="mini" v-model="scope.row.xq">
                            <el-option v-for="item in xqdata"
                                       :key="item.xq"
                                       :label="item.xq"
                                       :value="item.xq">
                                <span style="float: left">{{ item.xq }}</span>
                                <span v-show="item.isnow=='Y'" style="float: right; color: #8492a6; font-size: 13px">当前 </span>
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>
                <el-table-column prop="czstime"
                                 label="开始时间"
                                 width="250">
                    <template slot-scope="scope">
                        <el-date-picker v-model="scope.row.czstime"
                                        type="datetime"
                                        value-format="yyyy-MM-dd HH:mm:ss"
                                        size="mini"
                                        placeholder="选择开始时间">
                        </el-date-picker>
                    </template>
                </el-table-column>
                <el-table-column prop="czetime"
                                 label="结束时间"
                                 width="250">
                    <template slot-scope="scope">
                        <el-date-picker v-model="scope.row.czetime"
                                        type="datetime"
                                        size="mini"
                                        value-format="yyyy-MM-dd HH:mm:ss"
                                        placeholder="选择结束时间">
                        </el-date-picker>
                    </template>
                </el-table-column>

                <el-table-column prop="qxdec"
                                 label="权限描述">
                </el-table-column>

            </el-table>
        </div>

    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        data: function () {
            return {
                qxtype: "",
                qxdata: [],
                xqdata: []

            }
        },
        methods: {
            qczqx: function () {
                var pro = this;
                $.getJSON('/api/Bll/ExeAction?Action=QJJW_GETCZQX', { P1: this.qxtype }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.qxdata = resultData.Result;
                    }
                })
            },
            saveczqx: function () {
                var pro = this;
                $.getJSON('/api/Bll/ExeAction?Action=QJJW_SAVECZQX', { P1: JSON.stringify(pro.qxdata) }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.qczqx();
                    }
                })
            }

        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.xqdata = JSON.parse(localStorage.getItem("xqdata"));
                if (pro.$root.pagedata.ExtData) {
                    pro.qxtype = pro.$root.pagedata.ExtData;
                    pro.qczqx();
                }

            })

        },
        watch: {

        }
    };
</script>